import request from '@/utils/request'
/**
 *
 * 班级管理
 *
 **/

 //分页查询
 export const getClass = (params: any) =>
  request({
    'url': `/class/page`,
    'method': 'get',
    params
  })
  export function getClassesByMajor(majorId) {
    return request({
      url: `/class/list`,
      method: 'get',
      params: { majorId }
    })
  }
 
    //新增班级
 export const addClass = (params: any) =>
  request({
    'url': '/class',
    'method': 'post',
    data:params
  })

    //根据id查询班级
 export const findClassById = (id: number) =>
  request({
    'url': `/class/${id}`,
    'method': 'get',
  })

      //更新班级
 export const updateClass = (params: any) =>
  request({
    'url': '/class',
    'method': 'put',
    data:params
  })
  // 批量删除学生
  export const deleteBatchClasss = (ids: number[]) =>
    request({
      'url': `/class`,
      'method': 'delete',
      params: { 
        ids: ids.join(',') // 将数组转换为逗号分隔的字符串
      }
    })